<?php
namespace daswork;

use \daswork\lib\Route;
use \daswork\lib\Config;

class App
{
    public static $classMap = array();#用于判断类是否存在，节约性能
 
    /**
     * 运行控制器和方法
     * @throws \Exception
     */
    public static function run()
    {
        self::init();
        $route = new Route();
        $ctrlClass = '\\app\\' . $route->model  . '\\' . "controller" . '\\'. $route->ctrl;
        $action = $route->action;
        
        $ctrl = new $ctrlClass();
        $ctrl->$action();
    }

    public static function init()
    {
        Config::load();
    }
}
